import { delToken, getToken, setToken } from '@/utils/storage'
export default {
  namespaced: true,
  state () {
    return {
      token: getToken() ? getToken() : 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJsa2QiLCJpYXQiOjE2NzE3MDQ1NjksIm1vYmlsZSI6bnVsbCwidXNlcklkIjoxLCJsb2dpblR5cGUiOjAsImV4cCI6MTY3MTcwNDU2OX0.qgKgc42sRxUOf7KrT-MoYbI6NsCjBjJRBJCwNEAI2mA'
    }
  },
  mutations: {
    setUserToken (state, token) {
      state.token = token
      setToken(token)
    },
    logout (state) {
      state.token = ''
      delToken()
    }

  }
}
